<!doctype html>
<html>
  <head>
		<title>window.onerror</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
    </style>
  </head>
  <body>
    <script>
    window.onerror=function(){
     alert('An error has occurred!')
    }
    </script>
    <script>
    document.write('hellow world'
    </script>
	</body>
</html>